package com.thinkfit.jy.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.common.lib.bean.ApplicationBean;
import com.thinkfit.jy.R;
import com.thinkfit.jy.utils.ImageLoadUtils;

import org.jetbrains.annotations.NotNull;


public class RunningApkAdapter extends BaseQuickAdapter<ApplicationBean, BaseViewHolder> {

    private Context mContext;

    public static final int HOME = 1;
    public static final int APPLICATION = 2;

    public RunningApkAdapter(Context context) {
        super(R.layout.item_apk);
        mContext = context;
    }


    @SuppressLint("MissingPermission")
    @Override
    protected void convert(@NotNull BaseViewHolder helper, ApplicationBean bean) {

        ImageView iv_apk_icon = helper.getView(R.id.iv_apk_icon);
        ImageView iv_apk_un = helper.getView(R.id.iv_apk_un);
        View tv_1 = helper.getView(R.id.tv_1);
        if(bean.getOpenStatus() == 1){
            tv_1.setVisibility(View.VISIBLE);
        }else {
            tv_1.setVisibility(View.INVISIBLE);
        }
        ImageLoadUtils.getInstance(mContext).setImageUtlRadius(iv_apk_icon,bean.getIcon(),0,11);
        System.out.println("ddddddddddddddddddddddd  当前置顶状态  :   "+bean.isForeground());
        if(bean.isForeground()){
            iv_apk_un.setVisibility(View.VISIBLE);
        }else {
            iv_apk_un.setVisibility(View.GONE);
        }

    }

}
